package com.ssm.service.Impl;

import com.ssm.dao.HouseDao;
import com.ssm.pojo.House;
import com.ssm.service.HouseService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
//房间服务实现类
//@Service("houseService")
@Service
public class HouseServiceImpl implements HouseService {
    @Autowired
    private HouseDao houseDao;

    //查询房间管理
    @Override
    public List<House> getAllHouses() {
        return houseDao.queryAllHouses();
    }

    //查询房间根据房间号
    @Override
    public List<House> getHouse(String name) {

        return houseDao.queryHouse(name);
    }


    //增加房间
    @Override
    public int insertHouse(House house) {
        return houseDao.insertHouse(house);
    }

    //删除房间
    @Override
    public int deleteHouse(String name) {
        return houseDao.deleteHouse(name);
    }

    //修改房间信息
    @Override
    public int updateHouse(House house) {
        return houseDao.updateHouse(house);
    }

    //查询房间根据房间是否住人
    @Override
    public List<House> queryHouseByState(String state) {
        return houseDao.queryHouseByState(state);
    }

    //查询房间根据房间类型
    @Override
    public List<House> queryHouseByAmount(String amount) {
        return houseDao.queryHouseByAmount(amount);
    }

    //查询房间根据价格(区间)
    @Override
    public List<House> queryHouseByPrices(@Param("price1") Double price1, @Param("price2")Double price2) {
        return houseDao.queryHouseByPrices(price1,price2);
    }

    //查询房间根据房间号(低于)
    @Override
    public List<House> queryHouseByPrice(Double price) {
        return houseDao.queryHouseByPrice(price);
    }

    @Override
    public House queryHouseById(String id) {

        return houseDao.queryHouseById(id);
    }
}
